/**
 * @param {number[]} height
 * @return {number}
 */
var maxArea = function (height) {
  let max = 0 //存储最大容积
  let l = 0 //左指针
  let r = height.length - 1 //右指针
  while (l < r) {
    let curArea = (r - l) * Math.min(height[l], height[r])//计算容积
    if (curArea > max) max = curArea//更新max容积
    height[l] > height[r] ? r-- : l++//移动最短的一边指针
  }
  return max
};